package com.strom.preconditions;

import com.google.common.base.*;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.Immutable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class PreconditionsDemo {

    public static void main(String[] args) {
        Object obj = new Object();
        Preconditions.checkNotNull(obj, "obj is null");
        Preconditions.checkArgument(1 >= 0, "Argument was %s but expected nonnegative", 1);
        Preconditions.checkPositionIndex(0,1);
        // Preconditions.checkState();

        // Verify.verifyNotNull(null);
        List<String> list = Arrays.asList("1", "2", null, "3");
        String aa = Joiner.on("}}").skipNulls().join(list);

        StringBuilder stringBuilder = Joiner.on(",").skipNulls().appendTo(new StringBuilder("111"), list);
        System.out.println(stringBuilder);
        String join = Joiner.on("&").withKeyValueSeparator("=").join(ImmutableMap.of("id", "123", "name", "green"));
        System.out.println(join);
        final Map<String, String> map = Splitter.on("&").withKeyValueSeparator("=").split("id=123&name=green");
        System.out.println(map);


        System.out.println(Ticker.systemTicker());
    }
}
